package so.sao.code.service.infrastructure.enums;

import so.sao.top.core.util.enums.NamedEnumEntity;

public enum ProductionRegister implements NamedEnumEntity<Integer> {

    TODO(10, "未设置"), MODIFIED(20, "修改"), IMMUTABLE(30, "不可修改");

    private Integer id;
    private String name;

	private ProductionRegister(Integer id, String name) {
		this.id = id;
		this.name = name;
    }

    @Override
    public Integer getValue() {
	return id;
    }

    @Override
    public String getName() {
	return name;
    }

	public static ProductionRegister fromValue(Integer id) {
		switch (id) {
		case 10:
			return TODO;
		case 20:
			return MODIFIED;
		case 30:
			return IMMUTABLE;
		default:
			throw new IllegalArgumentException("Value [" + id + "] not support!");
		}
	}
}
